Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 91902dda1024dd3f1c35cc41448a3a066bd02ec5


Parents : afbc80b
Author : Ivan <ivan@quad4.io>
Signature : Signature validation error
Date : 2026-05-06T00:35:38-05:00

fix(build-backend): improve bytecode cleanup to only remove .pyc/.pyo files if corresponding .py exists

Changes

1 files changed, 5 insertions(+), 1 deletions(-)


Diff

diff --git a/scripts/build-backend.js b/scripts/build-backend.js
index 53ec0077..678fccba 100755
--- a/scripts/build-backend.js
+++ b/scripts/build-backend.js
@@ -101,7 +101,11 @@ function stripPythonBytecodeArtifacts(dir) {
stripPythonBytecodeArtifacts(full);
}
} else if (ent.name.endsWith(".pyc") || ent.name.endsWith(".pyo")) {
- fs.unlinkSync(full);
+ const stem = ent.name.replace(/\.pyc$/i, "").replace(/\.pyo$/i, "");
+ const siblingPy = path.join(dir, `${stem}.py`);
+ if (fs.existsSync(siblingPy)) {
+ fs.unlinkSync(full);
+ }
}
}
}


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────